package com.aspose.cells;

class zbog {
   static double a = Math.sqrt(2.0D);
   static double b = Math.sqrt(3.141592653589793D);
   static double[] c;
   static int d = 32;
   static int e;
   static double[] f;
   private static double[] i;
   private static double[] j;
   private static double[] k;
   private static double[] l;
   static int g;
   static double[] h;

   static void a(String var0, int var1) {
      System.out.println(var0 + var1);
   }

   static double a(double[] var0, int var1, double[] var2, int var3, double var4) {
      double var8 = var0[var1 - 1];

      for(int var6 = var1 - 1; var6 > 0; --var6) {
         var8 = var4 * var8 + var0[var6 - 1];
      }

      double var10 = var2[var3 - 1];

      for(int var7 = var3 - 1; var7 > 0; --var7) {
         var10 = var4 * var10 + var2[var7 - 1];
      }

      double var12 = var8 / var10;
      return var12;
   }

   static double a(double var0) {
      double[] var2 = new double[]{3.3871328727963665D, 133.14166789178438D, 1971.5909503065513D, 13731.69376550946D, 45921.95393154987D, 67265.7709270087D, 33430.57558358813D, 2509.0809287301227D};
      double[] var3 = new double[]{1.0D, 42.31333070160091D, 687.1870074920579D, 5394.196021424751D, 21213.794301586597D, 39307.89580009271D, 28729.085735721943D, 5226.495278852854D};
      double var4 = 0.180625D - var0 * var0;
      double var6 = var0 * a(var2, 8, var3, 8, var4);
      return var6;
   }

   static double b(double var0) {
      double[] var2 = new double[]{1.4234371107496835D, 4.630337846156546D, 5.769497221460691D, 3.6478483247632045D, 1.2704582524523684D, 0.2417807251774506D, 0.022723844989269184D, 7.745450142783414E-4D};
      double[] var3 = new double[]{1.0D, 2.053191626637759D, 1.6763848301838038D, 0.6897673349851D, 0.14810397642748008D, 0.015198666563616457D, 5.475938084995345E-4D, 1.0507500716444169E-9D};
      double var4 = a(var2, 8, var3, 8, var0 - 1.6D);
      return var4;
   }

   static double c(double var0) {
      double[] var2 = new double[]{6.657904643501103D, 5.463784911164114D, 1.7848265399172913D, 0.29656057182850487D, 0.026532189526576124D, 0.0012426609473880784D, 2.7115555687434876E-5D, 2.0103343992922881E-7D};
      double[] var3 = new double[]{1.0D, 0.599832206555888D, 0.1369298809227358D, 0.014875361290850615D, 7.868691311456133E-4D, 1.8463183175100548E-5D, 1.421511758316446E-7D, 2.0442631033899397E-15D};
      double var4 = a(var2, 8, var3, 8, var0 - 5.0D);
      return var4;
   }

   static double d(double var0) {
      double var8 = var0 - 0.5D;
      if (var0 == 1.0D) {
         return 100000.0D;
      } else if (var0 == 0.0D) {
         return -100000.0D;
      } else {
         double var4;
         if (Math.abs(var8) <= 0.425D) {
            var4 = a(var8);
            return var4;
         } else {
            double var6 = var0 < 0.5D ? var0 : 1.0D - var0;
            double var2 = Math.sqrt(-Math.log(var6));
            if (var2 <= 5.0D) {
               var4 = b(var2);
            } else {
               var4 = c(var2);
            }

            return var0 < 0.5D ? -var4 : var4;
         }
      }
   }

   public static double a(int var0) {
      if (var0 < 0) {
         throw new IllegalArgumentException("ArgumentPositive\\r\\nParameter name: \"value");
      } else if (var0 <= 1) {
         return 0.0D;
      } else if (var0 >= e) {
         return e((double)var0 + 1.0D);
      } else {
         if (c == null) {
            c = new double[e];
         }

         return c[var0] != 0.0D ? c[var0] : (c[var0] = e((double)var0 + 1.0D));
      }
   }

   public static double a(int var0, int var1) {
      return var1 >= 0 && var0 >= 0 && var1 <= var0 ? Math.floor(0.5D + Math.exp(a(var0) - a(var1) - a(var0 - var1))) : 0.0D;
   }

   public static double e(double var0) {
      double[] var10 = new double[]{76.18009172947146D, -86.50532032941678D, 24.01409824083091D, -1.231739572450155D, 0.001208650973866179D, -5.395239384953E-6D};
      double var4 = var0;
      double var8 = var0 + 5.5D;
      var8 -= (var0 + 0.5D) * Math.log(var8);
      double var6 = 1.000000000190015D;

      for(int var11 = 0; var11 <= 5; ++var11) {
         var6 += var10[var11] / ++var4;
      }

      return -var8 + Math.log(2.5066282746310007D * var6 / var0);
   }

   public static double f(double var0) {
      if (var0 > 0.0D) {
         return Math.exp(e(var0));
      } else {
         double var2 = 1.0D - var0;
         double var4 = Math.sin(3.141592653589793D * var2);
         return zaoz.a(0.0D, var4) ? Double.NaN : 3.141592653589793D / (var4 * Math.exp(e(var2)));
      }
   }

   public static double a(double var0, double var2) {
      short var4 = 1000;
      double var5 = zaoz.a;
      double var7 = Double.MIN_VALUE / var5;
      if (var0 >= 0.0D && var2 >= 0.0D) {
         double var9 = e(var0);
         double var11;
         double var13;
         double var15;
         if (var2 >= var0 + 1.0D) {
            var11 = var2 + 1.0D - var0;
            var13 = 1.0D / var7;
            var15 = 1.0D / var11;
            double var24 = var15;

            for(int var19 = 1; var19 <= var4; ++var19) {
               double var20 = (double)(-var19) * ((double)var19 - var0);
               var11 += 2.0D;
               var15 = var20 * var15 + var11;
               if (Math.abs(var15) < var7) {
                  var15 = var7;
               }

               var13 = var11 + var20 / var13;
               if (Math.abs(var13) < var7) {
                  var13 = var7;
               }

               var15 = 1.0D / var15;
               double var22 = var15 * var13;
               var24 *= var22;
               if (Math.abs(var22 - 1.0D) <= var5 || var19 == var4 - 1) {
                  return 1.0D - Math.exp(-var2 + var0 * Math.log(var2) - var9) * var24;
               }
            }
         } else {
            if (var2 <= 0.0D) {
               return 0.0D;
            }

            var11 = var0;
            var15 = var13 = 1.0D / var0;

            for(int var17 = 0; var17 < var4; ++var17) {
               ++var11;
               var13 *= var2 / var11;
               var15 += var13;
               if (Math.abs(var13) < Math.abs(var15) * var5 || var17 == var4 - 1) {
                  return var15 * Math.exp(-var2 + var0 * Math.log(var2) - var9);
               }
            }
         }

         throw new IllegalArgumentException("ArgumentTooLargeForIterationLimit\\r\\nParameter name: \"a");
      } else {
         throw new IllegalArgumentException("Parameter name: " + var0 + " " + var2);
      }
   }

   static double a(double var0, double var2, double var4) {
      if (var0 < 0.0D) {
         return 0.0D;
      } else if (var0 == 0.0D) {
         return var2 == 1.0D ? 1.0D / var4 : 0.0D;
      } else if (var2 == 1.0D) {
         return Math.exp(-var0 / var4) / var4;
      } else {
         double var8 = e(var2);
         double var6 = Math.exp((var2 - 1.0D) * Math.log(var0 / var4) - var0 / var4 - var8) / var4;
         return var6;
      }
   }

   public static double b(double var0, double var2, double var4) {
      if (var0 == 1.0D) {
         var0 -= 1.0E-6D;
      } else if (var0 == 0.0D) {
         return 0.0D;
      }

      double var6;
      double var8;
      double var10;
      if (var0 < 0.05D) {
         var8 = Math.exp((e(var2) + Math.log(var0)) / var2);
         var6 = var8;
      } else if (var0 > 0.95D) {
         var8 = -com.aspose.cells.b.a.zq.a(1.0D - var0, 2.718281828459045D) + e(var2);
         var6 = var8;
      } else {
         var8 = d(var0);
         var10 = var8 < -0.5D * Math.sqrt(var2) ? var2 : Math.sqrt(var2) * var8 + var2;
         var6 = var10;
      }

      int var14 = 0;

      do {
         var10 = var0 - zbop.b(var6, var2, 1.0D);
         double var12 = a(var6, var2, 1.0D);
         if (var10 == 0.0D || var14++ > 64) {
            break;
         }

         var8 = var10 / Math.max(2.0D * Math.abs(var10 / var6), var12);
         double var17 = -((var2 - 1.0D) / var6 - 1.0D) * var8 * var8 / 4.0D;
         double var19 = var8;
         if (Math.abs(var17) < 0.5D * Math.abs(var8)) {
            var19 = var8 + var17;
         }

         if (var6 + var19 > 0.0D) {
            var6 += var19;
         } else {
            var6 /= 2.0D;
         }
      } while(Math.abs(var8) > 1.0E-10D * var6);

      if (Math.abs(var10) > 1.0E-10D * var0) {
         System.out.println("inverse failed to converge");
      }

      return var4 * var6;
   }

   public static double b(double var0, double var2) {
      return Math.exp(e(var0) + e(var2) - e(var0 + var2));
   }

   public static double c(double var0, double var2) {
      return e(var0) + e(var2) - e(var0 + var2);
   }

   public static double c(double var0, double var2, double var4) {
      if (var0 <= 0.0D) {
         return 0.0D;
      } else if (var0 >= 1.0D) {
         return 1.0D;
      } else {
         double var6 = a(1.0D, 0.0D, var2, var4, var0);
         return var6;
      }
   }

   static double a(double var0, double var2, double var4, double var6) {
      short var8 = 512;
      double var9 = Double.NEGATIVE_INFINITY;
      int var11 = 0;
      double var14 = 1.0D;
      double var16 = 1.0D - (var0 + var2) * var4 / (var0 + 1.0D);
      if (Math.abs(var16) < var9) {
         var16 = Double.NaN;
      }

      var16 = 1.0D / var16;

      double var12;
      for(var12 = var16; var11 < var8; ++var11) {
         int var18 = var11 + 1;
         double var19 = (double)var18 * (var2 - (double)var18) * var4 / ((var0 - 1.0D + (double)(2 * var18)) * (var0 + (double)(2 * var18)));
         var16 = 1.0D + var19 * var16;
         var14 = 1.0D + var19 / var14;
         if (Math.abs(var16) < var9) {
            var16 = Double.NaN;
         }

         if (Math.abs(var14) < var9) {
            var14 = Double.NaN;
         }

         var16 = 1.0D / var16;
         double var21 = var16 * var14;
         var12 *= var21;
         var19 = -(var0 + (double)var18) * (var0 + var2 + (double)var18) * var4 / ((var0 + (double)(2 * var18)) * (var0 + (double)(2 * var18) + 1.0D));
         var16 = 1.0D + var19 * var16;
         var14 = 1.0D + var19 / var14;
         if (Math.abs(var16) < var9) {
            var16 = Double.NaN;
         }

         if (Math.abs(var14) < var9) {
            var14 = Double.NaN;
         }

         var16 = 1.0D / var16;
         var21 = var16 * var14;
         var12 *= var21;
         if (Math.abs(var21 - 1.0D) < 1.0E-323D || var12 * Math.abs(var21 - 1.0D) < var6) {
            break;
         }
      }

      return var11 >= var8 ? Double.NaN : var12;
   }

   static double a(double var0, double var2, double var4, double var6, double var8) {
      if (var8 == 0.0D) {
         return var0 * 0.0D + var2;
      } else if (var8 == 1.0D) {
         return var0 * 1.0D + var2;
      } else {
         double var10;
         if (var4 > 100000.0D && var6 < 10.0D && var8 > var4 / (var4 + var6)) {
            var10 = var4 + (var6 - 1.0D) / 2.0D;
            return var0 * (1.0D - zbop.a(var6, -var10 * Math.log(var8))) + var2;
         } else if (var6 > 100000.0D && var4 < 10.0D && var8 < var6 / (var4 + var6)) {
            var10 = var6 + (var4 - 1.0D) / 2.0D;
            return var0 * zbop.a(var4, -var10 * Math.log(1.0D - var8)) + var2;
         } else {
            var10 = c(var4, var6);
            double var12 = -var10 + var4 * Math.log(var8) + var6 * Math.log(1.0D - var8);
            double var14 = Math.exp(var12);
            double var16;
            double var18;
            if (var8 < (var4 + 1.0D) / (var4 + var6 + 2.0D)) {
               var16 = Math.abs(var2 / (var0 * var14 / var4)) * Double.MIN_VALUE;
               var18 = a(var4, var6, var8, var16);
               return var0 * (var14 * var18 / var4) + var2;
            } else {
               var16 = Math.abs((var0 + var2) / (var0 * var14 / var6)) * Double.MIN_VALUE;
               var18 = a(var6, var4, 1.0D - var8, var16);
               double var20 = var14 * var18 / var6;
               return var0 == -var2 ? -var0 * var20 : var0 * (1.0D - var20) + var2;
            }
         }
      }
   }

   static double a(double var0, double var2, double var4, double var6, double var8, double var10) {
      double var12 = 0.0D;

      for(double var14 = 1.0D; Math.abs(var14 - var12) > var8; var0 = 0.5D * (var12 + var14)) {
         double var16 = c(var0, var4, var6);
         if (Math.abs(var16 - var2) < var10) {
            return var0;
         }

         if (var16 < var2) {
            var12 = var0;
         } else if (var16 > var2) {
            var14 = var0;
         }
      }

      return var0;
   }

   static double d(double var0, double var2, double var4) {
      if (var0 >= 0.0D && var0 <= 1.0D) {
         double var8 = e(var2 + var4);
         double var10 = e(var2);
         double var12 = e(var4);
         double var6;
         if (var0 != 0.0D && var0 != 1.0D) {
            var6 = Math.exp(var8 - var10 - var12 + Math.log(var0) * (var2 - 1.0D) + Math.log(1.0D - var0) * (var4 - 1.0D));
         } else {
            var6 = Math.exp(var8 - var10 - var12) * Math.pow(var0, var2 - 1.0D) * Math.pow(1.0D - var0, var4 - 1.0D);
         }

         return var6;
      } else {
         return 0.0D;
      }
   }

   public static double e(double var0, double var2, double var4) {
      if (var0 < 0.0D || var0 > 1.0D) {
         a("P must be in range 0 < P < 1", 1);
      }

      if (var2 < 0.0D) {
         a("a < 0", 1);
      }

      if (var4 < 0.0D) {
         a("b < 0", 1);
      }

      if (var0 == 0.0D) {
         return 0.0D;
      } else if (var0 == 1.0D) {
         return 1.0D;
      } else if (var0 > 0.5D) {
         return f(1.0D - var0, var2, var4);
      } else {
         double var8 = var2 / (var2 + var4);
         double var6;
         double var10;
         double var12;
         double var14;
         if (var0 < 0.1D) {
            var10 = e(var2 + var4);
            var12 = e(var2);
            var14 = e(var4);
            double var16 = (Math.log(var2) + var12 + var14 - var10 + Math.log(var0)) / var2;
            if (var16 <= 0.0D) {
               var6 = Math.exp(var16);
               var6 *= Math.pow(1.0D - var6, -(var4 - 1.0D) / var2);
            } else {
               var6 = var8;
            }

            if (var6 > var8) {
               var6 = var8;
            }
         } else {
            var6 = var8;
         }

         var6 = a(var6, var0, var2, var4, 0.01D, 0.01D);
         int var23 = 0;

         do {
            var12 = var0 - c(var6, var2, var4);
            var14 = d(var6, var2, var4);
            if (var12 == 0.0D || var23++ > 64) {
               break;
            }

            var10 = var12 / Math.max(2.0D * Math.abs(var12 / var6), var14);
            double var19 = -((var2 - 1.0D) / var6 - (var4 - 1.0D) / (1.0D - var6)) * var10 * var10 / 2.0D;
            double var21;
            if (Math.abs(var19) < Math.abs(var10)) {
               var21 = var10 + var19;
            } else {
               var21 = var10 * 2.0D * Math.abs(var10 / var19);
            }

            if (var6 + var21 > 0.0D && var6 + var21 < 1.0D) {
               var6 += var21;
            } else {
               var6 = Math.sqrt(var6) * Math.sqrt(var8);
            }
         } while(Math.abs(var10) > 1.0E-10D * var6);

         if (Math.abs(var12) > 1.0E-10D * var0) {
            a("inverse failed to converge", 1);
         }

         return var6;
      }
   }

   public static double f(double var0, double var2, double var4) {
      if (var0 < 0.0D || var0 > 1.0D) {
         a("Q must be inside range 0 < Q < 1", 1);
      }

      if (var2 < 0.0D) {
         a("a < 0", 1);
      }

      if (var4 < 0.0D) {
         a("b < 0", 1);
      }

      if (var0 == 0.0D) {
         return 1.0D;
      } else if (var0 == 1.0D) {
         return 0.0D;
      } else {
         return var0 > 0.5D ? e(1.0D - var0, var2, var4) : 1.0D - e(var0, var4, var2);
      }
   }

   static {
      e = 2 * d;
      f = new double[]{1.0D, 1.0D, 2.0D, 6.0D, 24.0D, 120.0D, 720.0D, 5040.0D, 40320.0D, 362880.0D, 3628800.0D, 3.99168E7D, 4.790016E8D, 6.2270208E9D, 8.71782912E10D, 1.307674368E12D, 2.0922789888E13D, 3.55687428096E14D, 6.402373705728E15D, 1.21645100408832E17D, 2.43290200817664E18D, 5.109094217170944E19D, 1.1240007277776077E21D, 2.585201673888498E22D, 6.204484017332394E23D, 1.5511210043330986E25D, 4.0329146112660565E26D, 1.0888869450418352E28D, 3.0488834461171387E29D, 8.841761993739702E30D, 2.6525285981219107E32D, 8.222838654177922E33D};
      i = new double[]{-39.69683028665376D, 220.9460984245205D, -275.9285104469687D, 138.357751867269D, -30.66479806614716D, 2.506628277459239D};
      j = new double[]{-54.47609879822406D, 161.5858368580409D, -155.6989798598866D, 66.80131188771972D, -13.28068155288572D};
      k = new double[]{-0.007784894002430293D, -0.3223964580411365D, -2.400758277161838D, -2.549732539343734D, 4.374664141464968D, 2.938163982698783D};
      l = new double[]{0.007784695709041462D, 0.3224671290700398D, 2.445134137142996D, 3.754408661907416D};
      g = 32;
      h = new double[]{0.0D, 1.0D, 1.5D, 1.8333333333333333D, 2.0833333333333335D, 2.283333333333333D, 2.45D, 2.592857142857143D, 2.717857142857143D, 2.828968253968254D, 2.9289682539682538D, 3.019877344877345D, 3.103210678210678D, 3.180133755133755D, 3.2515623265623264D, 3.3182289932289932D, 3.3807289932289932D, 3.4395525226407577D, 3.4951080781963135D, 3.547739657143682D, 3.597739657143682D, 3.6453587047627294D, 3.690813250217275D, 3.73429151108684D, 3.7759581777535067D, 3.8159581777535068D, 3.8544197162150455D, 3.8914567532520823D, 3.927171038966368D, 3.961653797587058D, 3.994987130920391D, 4.02724519543652D};
   }
}
